class Solution {
public:
    bool canConstruct(string ransomNote, string magazine) {
        unordered_map<char, int> umap;
        for (auto a : magazine){
            umap[a]++;
        }
        for (auto b : ransomNote){
            if (umap.find(b) != umap.end()){ // 找到了
                umap[b]--;
                if (umap[b] < 0){
                    return false;
                }
            } else {
                return false;
            }
        }
        return true;
    }
};